<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Ajax的创建</title>
</head>
<body>

</body>
</html>

<script>
    var xhr = null;
    if (window.XMLHttpRequest){
        xhr = new XMLHttpRequest();
    }else {
        xhr = new ActiveXObject('Microsoft.XMLHTTP');
    }
    // 准备发送请求
    xhr.open('GET','https://www.zhihu.com/',true);
    xhr.send(null);
    xhr.onreadystatechange = function () {
        console.log(xhr.readyState);
        if (xhr.readyState == 4)
        {
            if (xhr.status == 200){
                console.log(xhr.responseText);
                document.body.innerHTML = xhr.responseText;
            }
        }
    }
</script>